import LinkedList from '../data-structures/linked-list';
import { Node } from '../data-structures/models/linked-list-models';

export const reverseList = (list:LinkedList<any>):Node<any>|undefined=>{
  console.log('11');
  let head = list.getHead();
  let prev:Node<any>|undefined = undefined;
  let current = head;
  while (current !=null) {
    let nextTemp = current.next;
    current.next = prev;
    prev = current;
    current = nextTemp;
  }
  return prev;
}
